from django.db import models
from utils.modelsMinxin import ModelsSetMixin

from django.contrib.auth.models import User
# Create your models here.


#  二次封装

class UserDetail(ModelsSetMixin):
    SEX_CHOICES = ((0,'女'),(1,'男'))
    avatar = models.TextField(null=True,blank=True,verbose_name="头像")
    phone = models.CharField(max_length=11,null=True,blank=True,verbose_name="手机号",unique=True)
    age = models.IntegerField(null=True, blank=True, verbose_name='年龄')
    sex = models.IntegerField(null=True, blank=True, verbose_name='性别', choices=SEX_CHOICES)
    birthday = models.DateTimeField(null=True, blank=True, verbose_name='生日',)
    #  外键字段
    user = models.OneToOneField(User,on_delete=models.CASCADE)

    class Meta:
        db_table = 'user_detail'
